package com.yowasa.xiuxian.engine.message.activity;

import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.yowasa.xiuxian.annoations.CMD;
import com.yowasa.xiuxian.engine.BattleEngine;
import com.yowasa.xiuxian.engine.message.CmdMessageHandler;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.mys.SendMessage;
import com.yowasa.xiuxian.exception.HandlerException;
import com.yowasa.xiuxian.service.RedisService;
import com.yowasa.xiuxian.service.helper.BattleHelper;
import com.yowasa.xiuxian.service.helper.ExtendHelper;
import com.yowasa.xiuxian.service.helper.MessageHelper;
import com.yowasa.xiuxian.service.helper.UserHelper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


@CMD(name = "/数据迁移")
public class GenShinHandler extends CmdMessageHandler {
    @Autowired
    private MessageHelper messageHelper;
    @Autowired
    private UserHelper userHelper;

    @Override
    public void execute(SendMessage message) {

        UserBO userBO = userHelper.checkOpUser(message);

        String s = userHelper.selectBindKey(userBO.getUserId());
        if(StrUtil.isBlank(s)){
            s = RandomUtil.randomString(10);
            userHelper.insertDataBind(userBO.getUserId(),s);
        }
        messageHelper.replyMys(message,"你的数据密钥为："+s);
    }


    public String desc() {
        return "深渊挑战";
    }


}
